package com.dissertation.service.impl;

import com.dissertation.model.Template;
import com.dissertation.respository.TemplateRepository;
import com.dissertation.service.TemplateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TemplateImpl implements TemplateService{

    @Autowired
    TemplateRepository templateRepository;

    @Override
    public String insertTemplate(Template template) {
        template = templateRepository.insert(template);
        return template.getId();
    }

    @Override
    public Template findByCategoryTreeNameAndCategoryLeafName(String categoryTreeName, String categoryLeafName) {
        return templateRepository.findByCategoryTreeNameAndCategoryLeafName(categoryTreeName, categoryLeafName);
    }
}
